import { Injectable, EventEmitter } from '@angular/core';

import { AppManageApirequest } from '../ApiRequest/AppManage.Apirequest';
import { appmanageServiceInterface } from './interface/appmanage.service.interface';
@Injectable()
export class AppManageService implements appmanageServiceInterface {

  /**
   * 创建app
   * @param AppId 
   * @param AppName 
   */
  async createApp(AppId: string, AppName: string): Promise<void> {
    return await this.accountApirequest.createApp(AppId, AppName);
  }

  /**
   * 更新app
   * @param AppId 
   * @param AppName 
   */
  async updateApp(AppId: string, AppName: string): Promise<void> {
    return await this.accountApirequest.updateApp(AppId, AppName);
  }

  /**
   * 删除app
   * @param AppId 
   */
  async deleteApp(AppId: string): Promise<void> {
    return await this.accountApirequest.deleteApp(AppId);
  }

  /**
   * 根据id获取app详情
   * @param appId 
   */
  async getAppById(appId: string): Promise<any> {
    return await this.accountApirequest.getAppById(appId);
  }

  /**
   * 获取app列表
   */
  async getAppList(): Promise<App[]> {
    return await this.accountApirequest.getAppList();
  }

  constructor(
    private accountApirequest: AppManageApirequest
  ) { }

}

export class App {
  "AppId": string;
  "AppName": string;
  "AppSecret": string;
  checked: boolean;
}